(function () {
    var todoTopItem = {
        init: function(todoList, renderData) {
            this.todoList = todoList;
            this.renderData = renderData;
            this.text = '';
        },
        setText: function(text) {
            this.text = text;
            this.renderData.todoTopItemText = text;
        },
        getText: function() {
            return this.text;
        },
        show: function() {
            this.renderData.todoTopItemDisplay = 'block';
        },
        hide: function() {
            this.renderData.todoTopItemDisplay = 'none';
        },
        smoothShow: function() {
            var animation = wx.createAnimation({duration:150});
            animation.opacity(1).step();
            this.renderData.todoTopItemAnimtaion = animation.export();
        },
        smoothHide: function() {
            var animation = wx.createAnimation({duration:150});
            animation.opacity(0).step();
            this.renderData.todoTopItemAnimtaion = animation.export();
        },
        setOpacity: function(o) {
            this.renderData.todoTopItemOpacity = o;
        },
        setRotateX: function(r) {
            var animation = wx.createAnimation({duration:0});
            animation.rotateX(r).step();
            this.renderData.todoTopItemAnimtaion = animation.export();
        }
    };

    function createTodoTopItem() {
        return Object.create(todoTopItem);
    }

    module.exports = {
        createTodoTopItem: createTodoTopItem
    };
})();